import request from "@/request/baseAxios";

// 获取全部用户信息
export const getCates = (type = 1) => {
  return request({
    url: `/api/categories?type=${type}`,
    method: "get",
  });
};

export const updateCate = (id, data) => {
  return request({
    url: `/api/categories/${id}`,
    method: "put",
    data,
  });
};

export const deleteCate = (id) => {
  return request({
    url: `/api/categories/${id}`,
    method: "delete",
  });
};

export const addCate = (data) => {
  return request({
    url: "/api/categories",
    method: "post",
    data,
  });
};

export const getCateById = (id) => {
  return request({
    url: `/api/categories/${id}`,
    method: "get",
  });
};
